﻿@typeparam TValue
@inherits Blazorise.Radio<TValue>
<label class="@WrapperClassNames">
    <span class="@CheckboxClassNames">
        <input @ref="@ElementRef" id="@ElementId" type="radio" class="@ClassNames" style="@StyleNames" disabled="@IsDisabled" readonly="@ReadOnly" checked="@CurrentValue" value="@Value" tabindex="@TabIndex" @onchange="@OnChangeHandler" @onkeydown="@OnKeyDownHandler" @onkeypress="@OnKeyPressHandler" @onkeyup="@OnKeyUpHandler" @onblur="@OnBlurHandler" @onfocus="@OnFocusHandler" @onfocusin="@OnFocusInHandler" @onfocusout="@OnFocusOutHandler" name="@Group" @attributes="@Attributes" />
        <span class="@InnerClassNames"></span>
    </span>
    <span>
        @ChildContent
        @Feedback
    </span>
</label>
@code{
    // Ant design doesn't have appearance for custom radio button colors.
    // So for now I will skip support for it until I find a good way.
    string WrapperClassNames => AsButton == true
        ? $"ant-radio-button-wrapper{( Checked ? " ant-radio-button-wrapper-checked" : "" )}"
        : $"ant-radio-wrapper{( Checked ? " ant-radio-wrapper-checked" : "" )}";

    string CheckboxClassNames => AsButton == true
        ? $"ant-radio-button{( Checked ? " ant-radio-button-checked" : "" )}"
        : $"ant-radio{( Checked ? " ant-radio-checked" : "" )}";

    string InnerClassNames => AsButton == true
        ? "ant-radio-button-inner"
        : "ant-radio-inner";
}
